//
//  OilChangeViewController.m
//  EasyToTesco
//
//  Created by mc on 16/2/22.
//  Copyright © 2016年 Jack. All rights reserved.
//

#import "OilChangeViewController.h"
#import "HeaderFileForEasyToTesco.h"
#import "CreditButtonView.h"

//
#import "AFNetworking.h"

//
#import "FkfsView.h"
//获取鞥路信息
#import "ReadLoginData.h"

//二级密码输入框
#import "RKAlertView.h"


@interface OilChangeViewController ()<UITableViewDataSource, UITableViewDelegate, UITextFieldDelegate, FkfsViewDelegate>{
    //实际价格
    NSMutableArray *OilMoneyArray;
    //标价
    NSMutableArray *OilPriceTagArray;
    
    //用户名
    NSString *usernameText;
    NSString *youkaStr;
    //持卡者姓名
    UITextField *Nametext;
    //二级付款密码
    NSString *pwdTwoText;
    
    //获取一个高度
    CGFloat headerHight;
    
    
    //付款方式,, 0是积分付款,,1是余额付款
    NSString *FkfsStr;
    
<<<<<<< HEAD
    
    
=======
>>>>>>> dd1aac4040986135177ad18eb7781566439f59ee
}
@property(nonatomic, strong)UITableView *OilChangeTableview;

@property (nonatomic, strong)UITextField *phoneTextFeild;
<<<<<<< HEAD
@property (nonatomic, strong)UILabel *phoneNumText;
=======
@property (nonatomic, strong)UITextField *NameTextFeild;

/**
 *  卡号
 */
@property (nonatomic, strong)UILabel *cardLabel;
>>>>>>> dd1aac4040986135177ad18eb7781566439f59ee

@property (nonatomic, strong)UIView *OilLineView;
@property (nonatomic, strong)UIView *OilTempView;


//售价
@property (nonatomic, copy)NSString *price;
<<<<<<< HEAD
=======

//手机号码
//UITextField *phoneNumText;

>>>>>>> dd1aac4040986135177ad18eb7781566439f59ee
@end

@implementation OilChangeViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view from its nib.
    
    [self oilInitSomething];
    
    [self OilChangeUI];
}
- (void)oilInitSomething {
    OilMoneyArray = [[NSMutableArray alloc] initWithObjects:@"100", @"500", nil];
    OilPriceTagArray = [NSMutableArray arrayWithObjects:@"100", @"500", nil];
    self.price = [OilMoneyArray firstObject];
    FkfsStr = @"0";
    
//    usernameText = @"15937728275";
    
}

- (void)OilChangeUI {
    //加载顶部视图
    [self OilChangeTopView];
    
    
    //添加其他的UI
//    [self addOilChangeMainUI];
//    
//    //添加充值选择按钮
//    [self addOilChangeSelectBtn];
    
    [self addOilChangeMainUI:self.view];
    
    [self addOilChangeSelectBtn:self.view];
    
    [self addOptionView:self.view];
    
    
    
    [self addOilChangetableview];
}

- (void)OilChangeTopView {
    self.titleLabel.text = @"中国石油充值";
    UIImageView *image1 = [[UIImageView alloc] initWithFrame:CGRectMake(10, (self.secondView.frame.size.height-20)/2, 20, 20)];
    image1.image = [UIImage imageNamed:@"goback-icon.png"];
    [self.secondView addSubview:image1];
    self.leftBtn.hidden = YES;
    
    UIButton *goBackBtn = [UIButton buttonWithType:UIButtonTypeCustom];
    goBackBtn.frame = CGRectMake(0, 0, self.secondView.frame.size.height, self.secondView.frame.size.height);
    [goBackBtn addTarget:self action:@selector(gobackClick) forControlEvents:UIControlEventTouchUpInside];
    [self.secondView addSubview:goBackBtn];
}

//添加tableview用于刷新数据
- (void)addOilChangetableview {
    self.OilChangeTableview = [[UITableView alloc] initWithFrame:CGRectMake(0, headerHight+5, WEITH, 100) style:UITableViewStylePlain];
    self.OilChangeTableview.dataSource = self;
    self.OilChangeTableview.delegate = self;
<<<<<<< HEAD
//    self.OilChangeTableview.scrollEnabled = NO;
=======
    self.OilChangeTableview.scrollEnabled = NO;
>>>>>>> dd1aac4040986135177ad18eb7781566439f59ee
    self.OilChangeTableview.tableFooterView = [[UIView alloc] init];
    [self.view addSubview:self.OilChangeTableview];
}

//返回上一级页面
- (void)gobackClick {
    [self dismissViewControllerAnimated:YES completion:nil];
}

- (void)addOilChangeMainUI:(UIView *)fatherView {
<<<<<<< HEAD
    UITextField *phoneTextField = [[UITextField alloc] initWithFrame:CGRectMake(10, CGRectGetMaxY(self.secondView.frame)+10, WEITH-20, 30)];
    phoneTextField.placeholder = @"请输入手机号码";
    phoneTextField.clearButtonMode = UITextFieldViewModeAlways;
    phoneTextField.keyboardType = UIKeyboardTypeNumberPad;
    //UITextFieldViewModeAlways
    phoneTextField.delegate = self;
    phoneTextField.clearButtonMode = UITextFieldViewModeAlways;
    phoneTextField.font = [UIFont systemFontOfSize:18];
=======
    
    UILabel *cardLabel = [[UILabel alloc] initWithFrame:CGRectMake(10, CGRectGetMaxY(self.secondView.frame) + 10,WEITH - 20, 30)];
    
    cardLabel.font = [UIFont systemFontOfSize:16];
    cardLabel.textColor = [UIColor grayColor];
    cardLabel.text = @"加油卡号";
    [fatherView addSubview:cardLabel];
    self.cardLabel = cardLabel;
    
    UITextField *phoneTextField = [[UITextField alloc] initWithFrame:CGRectMake(10, CGRectGetMaxY(cardLabel.frame)+10, WEITH-20, 30)];
    phoneTextField.placeholder = @"请输入提醒的手机号码";
    phoneTextField.clearButtonMode = UITextFieldViewModeAlways;
    phoneTextField.keyboardType = UIKeyboardTypeNumberPad;
    phoneTextField.font = [UIFont systemFontOfSize:16];
    //UITextFieldViewModeAlways
    phoneTextField.delegate = self;
>>>>>>> dd1aac4040986135177ad18eb7781566439f59ee
    [phoneTextField addTarget:self action:@selector(textFieldDidChange:) forControlEvents:UIControlEventEditingChanged];
    phoneTextField.layer.borderWidth = 1;
    phoneTextField.layer.cornerRadius = 6;
    phoneTextField.layer.masksToBounds = YES;
    self.phoneTextFeild = phoneTextField;
    [fatherView addSubview:self.phoneTextFeild];
    
    //号码归属地
<<<<<<< HEAD
    self.phoneNumText = [[UILabel alloc] initWithFrame:CGRectMake(10, CGRectGetMaxY(self.phoneTextFeild.frame) + 5, WEITH - 20, 20)];
    self.phoneNumText.text = @"手机号码归属地";
    self.phoneNumText.font = [UIFont systemFontOfSize:12];
    
    [fatherView addSubview:self.phoneNumText];
    
    //持卡者姓名
    Nametext = [[UITextField alloc] initWithFrame:CGRectMake(10, CGRectGetMaxY(self.phoneNumText.frame)+5, WEITH-20, 30)];
    Nametext.placeholder = @"输入持卡者姓名";
    Nametext.font = [UIFont systemFontOfSize:14];
=======
//    self.phoneNumText = [[UILabel alloc] initWithFrame:CGRectMake(10, CGRectGetMaxY(self.phoneTextFeild.frame) + 5, WEITH - 20, 20)];
//    self.phoneNumText.text = @"手机号码归属地";
//    self.phoneNumText.font = [UI  Font systemFontOfSize:12];
//    
//    [fatherView addSubview:self.phoneNumText];
    
    //持卡者姓名
    Nametext = [[UITextField alloc] initWithFrame:CGRectMake(10, CGRectGetMaxY(self.phoneTextFeild.frame)+5, WEITH-20, 30)];
    Nametext.placeholder = @"请输入绑定持卡号姓名";
    Nametext.font = [UIFont systemFontOfSize:18];
>>>>>>> dd1aac4040986135177ad18eb7781566439f59ee
    Nametext.delegate = self;
    Nametext.layer.borderWidth = 1;
    Nametext.layer.cornerRadius = 6;
    Nametext.layer.masksToBounds = YES;
    Nametext.clearButtonMode = UITextFieldViewModeAlways;
    [fatherView addSubview:Nametext];
    
<<<<<<< HEAD
=======

    
>>>>>>> dd1aac4040986135177ad18eb7781566439f59ee
    
    FkfsView *tempfkfs = [[FkfsView alloc] initWithFrame:CGRectMake(10, CGRectGetMaxY(Nametext.frame)+5, WEITH-20, 60)];
    tempfkfs.titlelabel.text = @"支付方式";
    tempfkfs.layer.borderWidth = 1;
    tempfkfs.layer.cornerRadius = 6;
    tempfkfs.layer.masksToBounds = YES;
//    fkfsView.backgroundColor = [UIColor yellowColor];
    tempfkfs.delegate = self;
    
    [fatherView addSubview:tempfkfs];
    

    
    self.OilLineView = [[UIView alloc] initWithFrame:CGRectMake(0, CGRectGetMaxY(tempfkfs.frame)+10, WEITH, 1)];
    self.OilLineView.layer.borderWidth = 1;
    self.OilLineView.layer.borderColor = [UIColor grayColor].CGColor;
    [fatherView addSubview:self.OilLineView];
    
}

-(void)fkfsViewBtnClick:(UIButton *)button {
//    NSLog(@"8888888---%ld", button.tag);
    if (button.tag == 890) {
<<<<<<< HEAD
        FkfsStr = @"0";
    } else {
        FkfsStr = @"1";
=======
        FkfsStr = @"积分付款";
    } else {
        FkfsStr = @"余额付款";
>>>>>>> dd1aac4040986135177ad18eb7781566439f59ee
    }
    [self.OilChangeTableview reloadData];
}

//添加石油充值控件
- (void)addOilChangeSelectBtn:(UIView *)fatherview {
    CGFloat weith = (WEITH-40)/OilMoneyArray.count;
    CGFloat heigh = weith/2;
    self.OilTempView = [[UIView alloc] initWithFrame:CGRectMake(0, CGRectGetMaxY(self.OilLineView.frame)+10, WEITH, heigh+20)];
    self.OilTempView.userInteractionEnabled = YES;
    [fatherview addSubview:self.OilTempView];
    
        for (NSInteger i=0; i < OilMoneyArray.count; i++) {
                CreditButtonView *OilBtnview = [[CreditButtonView alloc] initWithFrame:CGRectMake(10+(weith+10)*i, 10, weith, heigh)];
                UIButton *creditBtn = [UIButton buttonWithType:UIButtonTypeCustom];
                creditBtn.frame = CGRectMake(0, 0, weith,heigh);
                OilBtnview.MoneyLabel.text = [NSString stringWithFormat:@"%@元", OilPriceTagArray[i]];
                OilBtnview.CountMoneyLabel.text = [NSString stringWithFormat:@"售价:%.2f元", [OilMoneyArray[i] floatValue]];
                OilBtnview.tag = 750+i;
                [self.OilTempView addSubview:OilBtnview];
                [OilBtnview addSubview:creditBtn];
                [creditBtn addTarget:self action:@selector(CreditButtonClick:) forControlEvents:UIControlEventTouchUpInside];
                if (i==0) {
                    OilBtnview.backgroundColor = [UIColor colorWithRed:52/255. green:147/255. blue:225/255. alpha:1];
                    OilBtnview.MoneyLabel.textColor = [UIColor whiteColor];
                    OilBtnview.CountMoneyLabel.textColor = [UIColor whiteColor];
                }
               
        }
    
//    [self addOptionView];
}

- (void)addOptionView:(UIView *)fatheView {
    UILabel *titleLabel = [[UILabel alloc] initWithFrame:CGRectMake(10, CGRectGetMaxY(self.OilTempView.frame), WEITH-20, 30)];
    titleLabel.text = @"温馨提示";
    titleLabel.font = [UIFont systemFontOfSize:16];
    titleLabel.textColor = [UIColor blackColor];
    [fatheView addSubview:titleLabel];
    
    NSArray *ARRAY = @[@"· 充值项目为中石化卡密产品", @"· 充值成功将发送短信至填写的手机号", @"· 请务必确保手机号无误", @"· 充值订单意境提交不可取消或修改", @"· 企业账户将无法充值"];
    for (NSInteger i = 0; i<5; i++) {
        UILabel *label = [[UILabel alloc] initWithFrame:CGRectMake(10, CGRectGetMaxY(titleLabel.frame)+(20+5)*i, WEITH-20, 20)];
        label.textColor = [UIColor blackColor];
        label.text = ARRAY[i];
        label.font = [UIFont systemFontOfSize:12];
        [fatheView addSubview:label];
        
        if (i==4) {
            headerHight = CGRectGetMaxY(label.frame)+20;
        }
        
    }
    

    
}

- (void)CreditButtonClick:(UIButton *)button {
    for (CreditButtonView *btnview in self.OilTempView.subviews) {
        if (btnview.tag == button.superview.tag) {
            btnview.backgroundColor = [UIColor colorWithRed:52/255. green:147/255. blue:225/255. alpha:1];
            btnview.MoneyLabel.textColor = [UIColor whiteColor];
            btnview.CountMoneyLabel.textColor = [UIColor whiteColor];
        } else {
            btnview.backgroundColor = [UIColor whiteColor];
            btnview.MoneyLabel.textColor = [UIColor blackColor];
            btnview.CountMoneyLabel.textColor = [UIColor blackColor];
        }
    
    }
    self.price = OilMoneyArray[button.superview.tag - 750];
    [self.OilChangeTableview reloadData];
}

#pragma mark -- UITableViewDataSource
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
    return 0;
}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
    return nil;
}


#pragma mark -- UITableViewDelegate

- (CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section {
    return 100;
}
- (nullable UIView *)tableView:(UITableView *)tableView viewForFooterInSection:(NSInteger)section {
    UIView *OilChangeFootView = [[UIView alloc] init];
    OilChangeFootView.backgroundColor = [UIColor whiteColor];
    OilChangeFootView.userInteractionEnabled = YES;
    
    
    
    UIButton *payButton = [UIButton buttonWithType:UIButtonTypeCustom];
    payButton.frame = CGRectMake(15, 10, WEITH - 30, 40);
    payButton.titleLabel.textAlignment = NSTextAlignmentCenter;
    [payButton setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
    payButton.backgroundColor = [UIColor colorWithRed:52/255. green:147/255. blue:225/255. alpha:1];
    [payButton setTitle:[NSString stringWithFormat:@"立即支付: %.2f 元", [self.price floatValue]] forState:UIControlStateNormal];
    [payButton addTarget:self action:@selector(payButtonClick) forControlEvents:UIControlEventTouchUpInside];
    [OilChangeFootView addSubview:payButton];
    return OilChangeFootView;
}

#pragma mark -- 立即支付按钮关联事件
- (void)payButtonClick {
    
    NSDictionary *dic = [ReadLoginData readLoginData];
    
    NSLog(@"%@", dic);
    if (dic.allKeys.count == 0) {
        UIAlertView *alview = [[UIAlertView alloc] initWithTitle:@"提示" message:@"你尚未登陆,请返回登录" delegate:nil cancelButtonTitle:@"确定" otherButtonTitles:nil, nil];
        [alview show];
    } else {
        usernameText = [NSString stringWithFormat:@"%@", [dic[@"data"] objectForKey:@"username"]];
        if (self.phoneTextFeild.text.length != 0 && usernameText.length != 0 && Nametext.text.length != 0) {
            BOOL judge = [self isMobileNumber:self.phoneTextFeild.text];
            if (judge == YES) {
                //弹出密码输入框
                [RKAlertView showAlertPlainTextWithTitle:@"提示框" message:nil cancelTitle:@"取消" confirmTitle:@"确认" alertViewStyle:UIAlertViewStylePlainTextInput confrimBlock:^(UIAlertView *alertView) {
                    NSLog(@"确认了输入：%@",[alertView textFieldAtIndex:0].text);
                    pwdTwoText = [alertView textFieldAtIndex:0].text;
                    [self OilDatasources];
                    
                } cancelBlock:^{
                    //                    NSLog(@"取消了");
                }];
            } else {
                UIAlertView *alview =[[ UIAlertView alloc] initWithTitle:@"提示" message:@"手机号码格式有误, 请重新输入..." delegate:nil cancelButtonTitle:@"确定" otherButtonTitles:nil, nil];
                [alview show];
                self.phoneTextFeild.text = nil;
            }
            
        } else {
            UIAlertView *alview =[[ UIAlertView alloc] initWithTitle:@"提示" message:@"请完善您的信息" delegate:nil cancelButtonTitle:@"确定" otherButtonTitles:nil, nil];
            [alview show];
        }
        }
    
    
    [self.OilChangeTableview reloadData];
}

#pragma mark -- UITextFieldDelegate
//触摸空白处回收键盘
-(void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event{
    [self.phoneTextFeild resignFirstResponder];
//    [usernameText resignFirstResponder];
    //持卡者姓名
    [Nametext resignFirstResponder];
    //二级付款密码
//    [pwdTwoText resignFirstResponder];
    
<<<<<<< HEAD
=======
    
>>>>>>> dd1aac4040986135177ad18eb7781566439f59ee
}
- (BOOL)textField:(UITextField *)textField shouldChangeCharactersInRange:(NSRange)range replacementString:(NSString *)string {
    if (textField == self.phoneTextFeild) {
        if (string.length == 0) return YES;
        
        NSInteger existedLength = textField.text.length;
        NSInteger selectedLength = range.length;
        NSInteger replaceLength = string.length;
        if (existedLength - selectedLength + replaceLength >= 12) {
            return NO;
        }
    }
    
    
    return YES;
}

- (void)textFieldDidChange:(UITextField *)textField
{
    if (textField == self.phoneTextFeild) {
        if (textField.text.length >=12) {
            textField.text = [textField.text substringToIndex:12];
        }
        #pragma mark -- 在这里判断手机号码的归属地
        if (textField.text.length>10) {
            [self receiveMessage:textField.text];
        }
    }
}


- (void)OilDatasources {
        AFHTTPRequestOperationManager *mgr = [AFHTTPRequestOperationManager manager];
    mgr.responseSerializer = [AFHTTPResponseSerializer serializer];
    
    NSString *username = usernameText;
    NSString *type = @"0";
    NSString *rcMoney = self.price;
    NSString *Name = Nametext.text;
    NSString *Phone = self.phoneTextFeild.text;
    NSString *Pwdtwo = pwdTwoText;
    NSString *Fkfs = FkfsStr;

    NSDictionary *param = @{@"username":[NSString stringWithFormat:@"%@", username], @"type":[NSString stringWithFormat:@"%@", type],@"rcMoney":[NSString stringWithFormat:@"%@", rcMoney], @"Name":[NSString stringWithFormat:@"%@", Name], @"Phone":[NSString stringWithFormat:@"%@", Phone], @"Pwdtwo":[NSString stringWithFormat:@"%@", Pwdtwo],@"Fkfs":[NSString stringWithFormat:@"%@", Fkfs]};
    
    [mgr POST:@"http://www.ylgw8.com/Gwc/ykcz" parameters:param success:^(AFHTTPRequestOperation *operation, id responseObject) {
        NSString *string = [[NSString alloc] initWithData:responseObject encoding:NSUTF8StringEncoding];
        
        NSLog(@"%@", string);
        
        [self.OilChangeTableview reloadData];
    } failure:^(AFHTTPRequestOperation *operation,NSError *error)
     {
         //         operation.response.statusCode;//404 401之类
//         NSLog(@"数据请求错误原因:%@", error);
//         NSLog(@"数据请求错误码:%ld", (long)operation.response.statusCode);
     }];
}


// 将JSON串转化为字典或者数组
- (id)toArrayOrNSDictionary:(NSData *)jsonData{
    NSError *error = nil;
    id jsonObject = [NSJSONSerialization JSONObjectWithData:jsonData
                                                    options:NSJSONReadingAllowFragments
                                                      error:&error];
    
    if (jsonObject != nil && error == nil){
        return jsonObject;
    }else{
        // 解析错误
        return nil;
    }
}

//用于对手机号码的归属地进查询
- (void)receiveMessage:(NSString *)phoneStr {
    AFHTTPRequestOperationManager *mgr = [AFHTTPRequestOperationManager manager];
    mgr.responseSerializer = [AFHTTPResponseSerializer serializer];
    
    NSString *account = phoneStr;
    
    
    NSDictionary *param = @{@"account":[NSString stringWithFormat:@"%@", account]};
    
    
<<<<<<< HEAD
    __weak OilChangeViewController *oilself = self;
=======
//    __weak OilChangeViewController *oilself = self;
>>>>>>> dd1aac4040986135177ad18eb7781566439f59ee
    
    [mgr GET:@"http://www.ylgw8.com/Index/getGS/" parameters:param success:^(AFHTTPRequestOperation *operation, id responseObject) {
        NSString *string = [[NSString alloc] initWithData:responseObject encoding:NSUTF8StringEncoding];
        
        NSLog(@"%@", string);
        
        
<<<<<<< HEAD
        NSDictionary *dic = [oilself toArrayOrNSDictionary:responseObject];
        
        
        self.phoneNumText.text = [NSString stringWithFormat:@"%@",  [NSString stringWithFormat:@"%@", dic[@"message"]]];
=======
//        NSDictionary *dic = [oilself toArrayOrNSDictionary:responseObject];
        
        
//        self.phoneNumText.text = [NSString stringWithFormat:@"%@",  [NSString stringWithFormat:@"%@", dic[@"message"]]];
>>>>>>> dd1aac4040986135177ad18eb7781566439f59ee
        
        
        
        
        [self.OilChangeTableview reloadData];
        
    } failure:^(AFHTTPRequestOperation *operation, NSError *error) {
        //         //         operation.response.statusCode;//404 401之类
        ////         NSLog(@"数据请求错误原因:%@", error);
        ////         NSLog(@"数据请求错误码:%ld", (long)operation.response.statusCode);
    }];
    
}

//判断手机号码
- (BOOL)isMobileNumber:(NSString *)mobileNum
{
    /**
     * 手机号码
     * 移动：134[0-8],135,136,137,138,139,150,151,157,158,159,182,183,187,188
     * 联通：130,131,132,152,155,156,185,186
     * 电信：133,1349,153,180,189
     */
    NSString * MOBILE = @"^1(3[0-9]|5[0-35-9]|8[0235-9])\\d{8}$";
    /**
     10         * 中国移动：China Mobile
     11         * 134[0-8],135,136,137,138,139,150,151,157,158,159,182,187,188, 183
     12         */
    NSString * CM = @"^1(34[0-8]|(3[5-9]|5[017-9]|8[2378])\\d)\\d{7}$";
    /**
     15         * 中国联通：China Unicom
     16         * 130,131,132,152,155,156,185,186 145
     17         */
    NSString * CU = @"^1(3[0-2]|5[256]|8[56])\\d{8}$";
    /**
     20         * 中国电信：China Telecom
     21         * 133,1349,153,180,189  181
     22         */
    NSString * CT = @"^1((33|53|8[019])[0-9]|349)\\d{7}$";
    /**
     25         * 大陆地区固话及小灵通
     26         * 区号：010,020,021,022,023,024,025,027,028,029
     27         * 号码：七位或八位
     28         */
    // NSString * PHS = @"^0(10|2[0-5789]|\\d{3})\\d{7,8}$";
    
    NSPredicate *regextestmobile = [NSPredicate predicateWithFormat:@"SELF MATCHES %@", MOBILE];
    NSPredicate *regextestcm = [NSPredicate predicateWithFormat:@"SELF MATCHES %@", CM];
    NSPredicate *regextestcu = [NSPredicate predicateWithFormat:@"SELF MATCHES %@", CU];
    NSPredicate *regextestct = [NSPredicate predicateWithFormat:@"SELF MATCHES %@", CT];
    
    if (([regextestmobile evaluateWithObject:mobileNum] == YES)
        || ([regextestcm evaluateWithObject:mobileNum] == YES)
        || ([regextestct evaluateWithObject:mobileNum] == YES)
        || ([regextestcu evaluateWithObject:mobileNum] == YES))
    {
        return YES;
    }
    else
    {
        return NO;
    }
}


- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
